<!DOCTYPE html>

<html xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://java.sun.com/jsp/jstl/core">


<h:head>


</h:head>

<h:body>

	<ui:composition>


		<h:form id="packet_filter_form">


			<p:panelGrid columns="6" style="min-width: 100%">
				<f:facet name="header">  Filtra Pacchetti  </f:facet>

				<h:outputLabel for="city" value="Citta: " />
				<p:inputText id="city" value="" label="Citta" />

				<h:outputLabel for="category" value="Categoria: " />
				<p:inputText id="category" label="Categoria" />


				<p:outputPanel width="100%" style="margin: 10px 10px 10px 10px">
					<h:outputText id="displayRange" value="Prezzo da a "
						style="padding: 5px" />
					<p:slider for="txt6,txt7" display="displayRange" style="width:100%"
						range="true" displayTemplate="Prezzo da {min} a {max}" />

				</p:outputPanel>
				<h:inputHidden id="txt6" />
				<h:inputHidden id="txt7" />
				<f:facet name="footer">
					<p:commandButton value="Filtra" icon="ui-icon-check"
						style="margin:0" />
				</f:facet>

			</p:panelGrid>



		</h:form>


		<h:form id="packet_list_form">
			<!-- START - Tabella dei pacchetti -->

			<p:dataTable value="#{pacchettoBean.listaPacchetti}" var="packet"
				id="cars" rowSelectMode="single" rows="10" selectionMode="single"
				selection="#{pacchettoBean.pacchettoSelezionato}"
				rowKey="#{packet.citta}" scrollable="true" liveScroll="true"
				scrollHeight="100">

				<!-- Definisco cosa deve fare con la selezione -->
				<p:ajax event="rowSelect" oncomplete="window.location.href='packet_detail.xhtml'" listener="#{pacchettoBean.onRowSelect}"/>



				<f:facet name="header"> Pacchetti disponibili </f:facet>

				<p:column>
					<f:facet name="header"> Citta </f:facet> 
                     		#{packet.citta}
				</p:column>

				<p:column>
					<f:facet name="header"> Prezzo </f:facet>
                    		 #{packet.prezzo}
				</p:column>

				<p:column>
					<f:facet name="header"> Sconto </f:facet>
                     		#{packet.sconto}
				</p:column>

				<p:column>
					<f:facet name="header"> Descrizione </f:facet>
                     		#{packet.descrizione_categoria}
				</p:column>
				
				<p:column>
					<f:facet name="header"> Data Partenza </f:facet>
                     		#{packet.dataPartenzaAsString}
				</p:column>
				
				<p:column>
					<f:facet name="header"> Data Ritorno </f:facet>
                     		#{packet.dataRitornoAsString}
				</p:column>

			</p:dataTable>

			<!-- END - Tabella dei pacchetti -->

		</h:form>



	</ui:composition>

</h:body>
</html>